package com.dingqb.ktdemo.enumm


enum class EnummD {
    BLUE,
    RED,
    BLACK
}

enum class Color(var argb: Int) {
    red(0xff0000),
    black(0x000000);

}

enum class FunF {

    Black {
        override fun getName2() = "black";
    },
    Red {
        override fun getName2() = "Red";
    };

    abstract fun getName2(): String;
}

fun main() {

    var en = EnummD.RED;
    println(en);
    println(en.name);
    println(en.ordinal);
    println(FunF.Black.getName2());

    println("\r\t\n\n")//
    println("------------------------------KOTLIN  简化繁琐的Java代码，------------------------------------------")

    AllP<Color>()

    ali();
}

inline fun <reified T : Enum<T>> AllP() {
    enumValues<T>().forEach { println("name=" + it.name + ",ordinal(序数)==" + it.ordinal) }
}

fun ali() {
    var l = listOf(1, 3, 4, 5, 6);
    l.forEach {
        when (it) {
            in 1..4 -> println(it)
            in 5..5 -> println(it);
        }

    }
}